<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用before和after伪元素在页面中插入图片</title>
    <style type="text/css">
        h2::before {
            content: "";
            background: url('../imgs/nezha.png');
            background-size: cover;
            padding: 50px 50px;
        }
        h2::after {
            content: "";
            color: #fff;
            background: url('../imgs/nezha.png');
            background-size: cover;
            padding: 50px 50px;
        }
    </style>
</head>
<body>
    <h2>使用before和after伪元素在页面中插入图片</h2>
</body>
</html>